﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Visifire.Charts;
using Visifire.Commons;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataChartBase
    {
        protected void SetDataPoint(DataPoint dataPoint)
        {
            if(dataPoint != null)
            {
                dataPoint.BorderColor = DataPointBorderColor==null? null : DataPointBorderColor.Brush;
                dataPoint.BorderStyle = DataPointBorderStyle;
                dataPoint.BorderThickness = DataPointBorderThickness;
                dataPoint.LabelAngle = DataPointLabelAngle % 90;
                dataPoint.LabelBackground = DataPointLabelBackground == null ? null : DataPointLabelBackground.Brush;
                dataPoint.LabelEnabled = DataPointLabelEnabled;
                dataPoint.LabelFontSize = DataPointLabelFontSize;
                dataPoint.LabelFontColor = DataPointLabelFontColor==null? null : DataPointLabelFontColor.Brush;
                dataPoint.LabelFontFamily = DataPointLabelFontFamily;
                dataPoint.LabelFontWeight = DataPointLabelFontWeight;
                dataPoint.LabelLineColor = DataPointLabelLineColor==null? null : DataPointLabelLineColor.Brush;
                dataPoint.LabelLineEnabled = DataPointLabelLineEnabled;
                dataPoint.LabelLineStyle = DataPointLabelLineStyle;
                dataPoint.LabelLineThickness = DataPointLabelLineThickness;
                dataPoint.LabelStyle = DataPointLabelStyle;
                dataPoint.LightingEnabled = DataPointLightingEnabled;
            }
        }

        private BrushEx dataPointBorderColor;
        private BorderStyles dataPointBorderStyle;
        private Thickness dataPointBorderThickness;
        private double dataPointLabelAngle;
        private BrushEx dataPointLabelBackground;
        private bool? dataPointLabelEnabled;
        private BrushEx dataPointLabelFontColor;
        private FontFamily dataPointLabelFontFamily;
        private FontWeight dataPointLabelFontWeight;
        private BrushEx dataPointLabelLineColor;
        private bool dataPointLabelLineEnabled;
        private LineStyles dataPointLabelLineStyle;
        private double? dataPointLabelLineThickness;
        private LabelStyles dataPointLabelStyle;
        private bool? dataPointLightingEnabled;
        private double? dataPointLabelFontSize;

        [Category("数据项")]
        [DisplayName("数据项边框颜色")]
        [Description("DataPointBorderColor")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointBorderColor", "数据项边框颜色")]
        public BrushEx DataPointBorderColor
        {
            get
            {
                return dataPointBorderColor;
            }

            set
            {
                dataPointBorderColor = value;
                Refresh();
            }
        }

        //暂不可用
        public BorderStyles DataPointBorderStyle
        {
            get
            {
                return dataPointBorderStyle;
            }

            set
            {
                dataPointBorderStyle = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项边框大小")]
        [Description("DataPointBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointBorderThickness", "数据项边框大小", true)]
        public Thickness DataPointBorderThickness
        {
            get
            {
                return dataPointBorderThickness;
            }

            set
            {
                dataPointBorderThickness = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项标签角度")]
        [Description("DataPointLabelAngle")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelAngle", "数据项标签角度", true)]
        public double DataPointLabelAngle
        {
            get
            {
                return dataPointLabelAngle;
            }

            set
            {
                dataPointLabelAngle = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项标签背景")]
        [Description("DataPointLabelBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelBackground", "数据项标签背景", true)]
        public BrushEx DataPointLabelBackground
        {
            get
            {
                return dataPointLabelBackground;
            }

            set
            {
                dataPointLabelBackground = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项标签是否可用")]
        [Description("DataPointLabelEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelEnabled", "数据项标签是否可用", true)]
        public bool? DataPointLabelEnabled
        {
            get
            {
                return dataPointLabelEnabled;
            }

            set
            {
                dataPointLabelEnabled = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项标签字体颜色")]
        [Description("DataPointLabelFontColor")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelFontColor", "数据项标签字体颜色", true)]
        public BrushEx DataPointLabelFontColor
        {
            get
            {
                return dataPointLabelFontColor;
            }

            set
            {
                dataPointLabelFontColor = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项标签字体")]
        [Description("DataPointLabelFontFamily")]
        [Editor(typeof(UI.XProperty.Editors.XFontFamilyEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelFontFamily", "数据项标签字体", true)]
        public FontFamily DataPointLabelFontFamily
        {
            get
            {
                return dataPointLabelFontFamily;
            }

            set
            {
                dataPointLabelFontFamily = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项标签字体粗细")]
        [Description("DataPointLabelFontWeight")]
        [Editor(typeof(UI.XProperty.Editors.XFontWeightEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelFontWeight", "数据项标签字体粗细", true)]
        public FontWeight DataPointLabelFontWeight
        {
            get
            {
                return dataPointLabelFontWeight;
            }

            set
            {
                dataPointLabelFontWeight = value;
                Refresh();
            }
        }

        //[Category("数据项")]
        //[DisplayName("数据项标签线颜色")]
        //[Description("DataPointLabelLineColor")]
        //[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        //[XProperty(XPropertyCategory.Other, "DataPointLabelLineColor", "数据项标签线颜色", true)]
        public BrushEx DataPointLabelLineColor
        {
            get
            {
                return dataPointLabelLineColor;
            }

            set
            {
                dataPointLabelLineColor = value;
                Refresh();
            }
        }

        //[Category("数据项")]
        //[DisplayName("数据项标签线是否可用")]
        //[Description("DataPointLabelLineEnabled")]
        //[Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        //[XProperty(XPropertyCategory.Other, "DataPointLabelLineEnabled", "数据项标签线是否可用", true)]
        public bool DataPointLabelLineEnabled
        {
            get
            {
                return dataPointLabelLineEnabled;
            }

            set
            {
                dataPointLabelLineEnabled = value;
                Refresh();
            }
        }

        //[Category("数据项")]
        //[DisplayName("数据项标签线样式")]
        //[Description("DataPointLabelLineStyle")]
        //[Editor(typeof(UI.DataPartLib.XProperty.Editors.XLineStylesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        //[XProperty(XPropertyCategory.Other, "DataPointLabelLineStyle", "数据项标签线样式", true)]
        public LineStyles DataPointLabelLineStyle
        {
            get
            {
                return dataPointLabelLineStyle;
            }

            set
            {
                dataPointLabelLineStyle = value;
                Refresh();
            }
        }

        //[Category("数据项")]
        //[DisplayName("数据项标签线大小")]
        //[Description("DataPointLabelLineThickness")]
        //[Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        //[XProperty(XPropertyCategory.Other, "DataPointLabelLineThickness", "数据项标签线大小", true)]
        public double? DataPointLabelLineThickness
        {
            get
            {
                return dataPointLabelLineThickness;
            }

            set
            {
                dataPointLabelLineThickness = value;
                Refresh();
            }
        }
        //暂不可用
        public LabelStyles DataPointLabelStyle
        {
            get
            {
                return dataPointLabelStyle;
            }

            set
            {
                dataPointLabelStyle = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项是否高亮")]
        [Description("DataPointLightingEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLightingEnabled", "数据项是否高亮", true)]
        public bool? DataPointLightingEnabled
        {
            get
            {
                return dataPointLightingEnabled;
            }

            set
            {
                dataPointLightingEnabled = value;
                Refresh();
            }
        }

        [Category("数据项")]
        [DisplayName("数据项字体大小")]
        [Description("DataPointLabelFontSize")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DataPointLabelFontSize", "数据项字体大小", true)]
        public double? DataPointLabelFontSize
        {
            get
            {
                return dataPointLabelFontSize;
            }

            set
            {
                dataPointLabelFontSize = value;
                Refresh();
            }
        }
    }
}
